package com.generator.controller.courseAnswers;

import com.generator.entity.courseAnswers.CourseAnswers;
import com.generator.service.courseAnswers.CourseAnswersService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/generate")
@CrossOrigin(allowCredentials = "true")
public class CourseAnswersController {

    @Autowired
    private CourseAnswersService courseAnswersService;

    @GetMapping("/findAllCourseAnswers")
    public List<CourseAnswers> findAllCourseAnswers(){
        return courseAnswersService.findAllCourseAnswers();
    }

    @GetMapping("/addCourseAnswers")
    public void addCourseAnswers(CourseAnswers courseAnswers){
        courseAnswersService.addCourseAnswers(courseAnswers);
    }

    @GetMapping("/delCourseAnswers")
    public void delCourseAnswers(int eid){
        courseAnswersService.delCourseAnswers(eid);
    }

    @GetMapping("/updateCourseAnswers")
    public void updateCourseAnswers(CourseAnswers courseAnswers){
        courseAnswersService.updateCourseAnswers(courseAnswers);
    }

    @GetMapping("/findCourseAnswerById")
    public CourseAnswers findCourseAnswerById(int eid){
        return courseAnswersService.findCourseAnswerById(eid);
    }

}
